//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        String data = "one";
        int result = switch (data){
            case "one" : yield 1;
            case "two" : yield 2;
            default : yield -1;
        };
        System.out.println(result);
    }
    public static void main2(String[] args) {
        String data = "one";
        int result = switch(data){
            case "one"->1;
            case "two"->2;
            default ->1;
        };
        System.out.println(result);
    }
    public static void main1(String[] args) {
        String data = "one" ;
        int result = 0 ; // 接收数据的返回值
        switch (data) {
            case "one":
                result = 1 ; // 为result重新赋值
                break ;
            case "two":
                result = 2 ; // 为result重新赋值
                break ;
            default:
                result = -1 ; // 为result重新赋值
                break ;
        }
        System.out.println(result) ;
    }
}